---@module 装饰器处理数据库连接状态
local _db = class("DBDecorator")

--======================================
--default params 
local d  = ngx.shared.d
local ngx_req = ngx.req
local Logger = d.Logger
local json = require("cjson")
--======================================

local EXPORTED_METHODS = {
    "is_ready_",
}

function _db:init_()  

end

function _db:bind(target)
    self:init_()
    d.setmethods(target, self, EXPORTED_METHODS)
    self._svr = target:svr() 
end

function _db:unbind(target)
    d.unbind(target, EXPORTED_METHODS)
end

function _db:is_ready_()
    if not self._inc then 
        Logger:error("DB inc create failed!")
        return false
    end
    if not self._iscon then 
        Logger:error("DB not connect yet!")
        return false
    end
    return true
end

return _base